package com.jie.controller;

import com.jie.response.RespBean;
import com.jie.service.ICommentService;
import com.jie.service.ILikeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/like")
@Api(tags = "点赞模块")
public class LikeController {
    @Autowired
    private ILikeService likeService;
    //给用户点赞
    //场景：1.用户主页 2.数字人社区用户“膜拜功能”，送花功能捆绑点赞
    @ApiOperation("给用户点赞")
    @GetMapping("/{id}")
    public RespBean<Boolean> likeUserByUid(@PathVariable("Uid") Integer Uid) {
        return RespBean.success("根据Uid指定点赞某用户",likeService.likeUserByUid(Uid));
    }
    //给评论点赞，倘若给父评论为null的对象评论，并同步给该数字人用户送花or点赞（可勾选，不强制）
    @ApiOperation("给评论点赞")
    @GetMapping("/{CommentId}")
    public RespBean<Boolean> likeByCommentId(@PathVariable("CommentId") Integer CommentId) {
        return RespBean.success("根据commentId点赞指定评论",likeService.likeByCommentId( CommentId));
    }
    //给帖子点赞
    @ApiOperation("给帖子点赞")
    @GetMapping("/{articleId}")
    public RespBean<Boolean> likeByArticleId(@PathVariable("articleId") Integer articleId) {
        return RespBean.success("根据articleId点赞指定帖子",likeService.likeByArticleId(articleId));
    }

}
